//引入Category下的二级分类列表API
import { reqSubCategory } from "@/apis/category";
import { ref, onMounted } from "vue";
import { useRoute } from "vue-router";
export const useBreadecrumb = () => {
  onMounted(() => {
    getSubCategory();
  });
  //储存二级分类面包屑列表的数据
  let subCategoryData = ref({});
  //获取当前路由实例
  let route = useRoute();
  //获取二级分类面包屑列表的数据的方法
  const getSubCategory = async () => {
    let res = await reqSubCategory(route.params.id);
    // console.log(res);
    subCategoryData.value = res.result;
  };
  return {
    subCategoryData,
  };
};
